package org.summerframework.component.security.oauth.qq;

import org.summerframework.component.security.oauth.LoginType;

public class QQMobileOAuthSupper extends QQOAuthSupper implements QQOAuthInterceptor {

    public QQMobileOAuthSupper(QQAppIdAndAppSecret qqMobileAppIdAndAppSecret) {
        super(qqMobileAppIdAndAppSecret);
    }

    @Override
    public QQUserInfo getResultInfo(QQAccessToken qqAccessToken) {
        QQUserInfo qqUserInfo = new QQUserInfo();
        qqUserInfo.setAccessToken(qqAccessToken.getCode());
        String openId = getOpenId(qqUserInfo.getAccessToken());
        qqUserInfo.setOpenid(openId);
        return qqUserInfo;
    }

    @Override
    public boolean supportsType(LoginType loginType) {
        return LoginType.QQ_MOBILE == loginType;
    }
}
